/* GIS Interface Specific Overrides from gis_explore.html */
:root {
    /* Overrides for Map Context */
    --panel-bg: rgba(10, 10, 10, 0.98);
    /* Higher opacity for map overlay */
    --hex-glow: rgba(59, 130, 246, 0.6);
}

body {
    font-family: var(--font-ui);
    background: #0f172a;
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* --- MAP CONTAINER --- */
#map {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: #111;
    /* Hardware acceleration hack for smoother motion */
    will-change: transform;
    transform: translateZ(0);
}

/* Custom Leaflet Styles for Dark Theme */
.leaflet-container {
    background: #111;
}

/* Hexagon Styles (SVG Overlay) */
.h3-hex {
    fill: var(--hex-blue);
    fill-opacity: 0.1;
    stroke: var(--hex-blue);
    stroke-width: 1;
    stroke-opacity: 0.3;
    transition: all 0.2s;
    cursor: pointer;
}

.h3-hex:hover {
    fill-opacity: 0.4;
    stroke-width: 2;
    stroke-opacity: 0.8;
    filter: drop-shadow(0 0 5px var(--hex-blue));
}

.h3-hex.high-density {
    fill: #ef4444;
    stroke: #ef4444;
}

.h3-hex.med-density {
    fill: #eab308;
    stroke: #eab308;
}

/* --- UI OVERLAYS --- */
.command-bar {
    height: 60px;
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 24px;
    z-index: 1000;
    justify-content: space-between;
    position: relative;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 16px;
}

.hex-logo {
    width: 42px;
    height: 36px;
    background: var(--text-main);
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
}

/* Custom Hex Popup */
.leaflet-popup-content-wrapper {
    background: rgba(17, 24, 39, 0.95);
    /* Dark background */
    color: white;
    border: 1px solid var(--hex-blue);
    border-radius: 0;
    padding: 0;
    clip-path: polygon(10% 0, 90% 0, 100% 50%, 90% 100%, 10% 100%, 0% 50%);
    /* Elongated Hexagon */
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.3);
}

.leaflet-popup-content {
    margin: 0;
    padding: 12px 24px;
    /* Adjust padding for hex shape */
    text-align: center;
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 13px;
    min-width: 180px;
}

.leaflet-popup-tip-container {
    display: none;
    /* Hide the default tip */
}

.leaflet-popup-close-button {
    display: none;
    /* Hide close button for cleaner look */
}

.omni-search {
    background: rgba(59, 130, 246, 0.3);
    border: none;
    color: white;
    padding: 10px 24px;
    width: 400px;
    font-family: var(--font-mono);
    font-size: 13px;
    outline: none;
    position: relative;
    clip-path: polygon(15px 0, calc(100% - 15px) 0, 100% 50%,
            calc(100% - 15px) 100%, 15px 100%, 0 50%);
}

.omni-search::before {
    content: '';
    position: absolute;
    inset: 2px;
    background: rgba(15, 23, 42, 0.9);
    clip-path: polygon(15px 0, calc(100% - 15px) 0, 100% 50%,
            calc(100% - 15px) 100%, 15px 100%, 0 50%);
    z-index: -1;
}

.omni-search::placeholder {
    color: var(--text-muted);
}

.omni-search:focus {
    background: var(--hex-blue);
}

.nav-dock {
    position: absolute;
    top: 60px;
    left: 0;
    bottom: 0;
    width: 64px;
    background: var(--panel-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 24px;
    z-index: 1000;
}

.dock-icon {
    width: 46px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
    font-size: 18px;
    filter: drop-shadow(0 0 0 1px var(--border-color));
    transition: all 0.2s;
}

.dock-icon::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.02);
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    z-index: -1;
    transition: background 0.2s;
}

.dock-icon:hover::before {
    background: rgba(59, 130, 246, 0.1);
}

.dock-icon:hover {
    color: var(--text-main);
    filter: drop-shadow(0 0 0 1.5px var(--hex-blue));
}

.dock-icon.active {
    color: white;
    filter: drop-shadow(0 0 0 2px var(--hex-blue));
}

.dock-icon.active::before {
    background: rgba(59, 130, 246, 0.2);
}

/* --- TOOLS DRAWER (Left) --- */
.tools-drawer {
    position: fixed;
    left: 64px;
    /* After nav dock */
    top: 60px;
    /* After header */
    width: 320px;
    height: calc(100vh - 60px);
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    border-right: 1px solid var(--border-color);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 30;
}

.tools-drawer.open {
    transform: translateX(0);
}

.drawer-header {
    padding: 20px 24px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border-color);
    clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 20px, 100% 100%, 0 100%);
}

.drawer-title {
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Improved Toggle Button States */
.drawer-content .btn-hex {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    filter: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s;
}

.drawer-content .btn-hex:hover {
    background: rgba(59, 130, 246, 0.15);
    color: white;
    border-color: var(--hex-blue);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}

.btn-hex.active {
    background: var(--hex-blue) !important;
    color: white !important;
    border-color: var(--hex-blue) !important;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.6) !important;
    filter: none;
}

.drawer-content {
    padding: 24px;
}

.layer-group {
    margin-bottom: 24px;
}

.layer-group-title {
    font-family: var(--font-ui);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 12px;
    letter-spacing: 0.05em;
}

.radio-item {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    cursor: pointer;
}

.radio-item input {
    margin-right: 10px;
    accent-color: var(--hex-blue);
}

.radio-item span {
    font-family: var(--font-ui);
    font-size: 14px;
    color: var(--text-main);
}

/* --- DATA PANEL (Right) --- */
.data-panel {
    position: fixed;
    right: 0;
    top: 60px;
    /* After header */
    width: 420px;
    height: calc(100vh - 60px);
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    border-left: 1px solid var(--border-color);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    z-index: 40;
}

.data-panel.open {
    transform: translateX(0);
}

.panel-header {
    padding: 24px;
    background-color: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border-color);
}

.panel-title {
    font-family: var(--font-ui);
    font-size: 18px;
    font-weight: 700;
    color: white;
}

.panel-subtitle {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.metrics-row {
    display: flex;
    gap: 16px;
    padding: 24px;
    justify-content: space-around;
}

.metric-hex {
    width: 100px;
    height: 115px;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.25);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 8px;
    text-align: center;
}

.metric-hex-value {
    font-family: var(--font-mono);
    font-size: 20px;
    font-weight: 700;
    color: white;
}

.metric-hex-label {
    font-family: var(--font-ui);
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* --- ZOOM CONTROLS --- */
.zoom-controls {
    position: fixed;
    right: 24px;
    bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 20;
}

.zoom-btn {
    width: 40px;
    height: 44px;
    background: rgba(17, 24, 39, 0.8);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    color: var(--text-main);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.zoom-btn:hover {
    background: var(--hex-blue);
    border-color: var(--hex-blue);
    color: white;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
}



.cursor-target {
    cursor: crosshair !important;
}

/* Header Info Hex */
.header-info-hex {
    height: 42px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--hex-blue);
    clip-path: polygon(15px 0, calc(100% - 15px) 0, 100% 50%, calc(100% - 15px) 100%, 15px 100%, 0 50%);
    display: flex;
    align-items: center;
    padding: 0 24px;
    margin-left: auto;
    /* Push to right */
    margin-right: 24px;
    /* Spacing */
    color: white;
    min-width: 250px;
    justify-content: center;
}

.header-info-hex .info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.1;
}

.header-info-hex .label {
    font-size: 8px;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.header-info-hex .value {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    color: var(--hex-blue);
}

/* Hex Label (ATM Count) */
.hex-label {
    background: transparent;
    border: none;
}

/* --- Context Menu --- */
.context-menu {
    position: fixed;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 0;
    min-width: 200px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: none;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s, transform 0.2s;
}

.context-menu.active {
    opacity: 1;
    transform: translateY(0);
}

.context-menu-header {
    padding: 8px 16px;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    font-weight: 600;
}

.context-menu-subtitle {
    padding: 0 16px 8px;
    font-size: 13px;
    color: white;
    font-weight: 500;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.context-menu-item {
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: background 0.2s;
    color: var(--text-main);
    font-size: 13px;
}

.context-menu-item:hover {
    background: rgba(59, 130, 246, 0.15);
    color: white;
}

.context-menu-color {
    width: 10px;
    height: 10px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

/* --- AHP Drawer Styles --- */
.hex-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
}

.hex-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 18px;
    background: var(--hex-blue);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    cursor: pointer;
    transition: transform 0.2s;
}

.hex-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: #60a5fa;
}

.hex-select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 12px;
    font-family: var(--font-ui);
    font-size: 13px;
    border-radius: 4px;
    outline: none;
}

.hex-select:focus {
    border-color: var(--hex-blue);
}

/* ── Omni-Search Dropdown ──────────────────────────────────────────── */
.search-box {
    position: relative;
}

.search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    min-width: 420px;
    max-height: 400px;
    overflow-y: auto;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 8px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(59, 130, 246, 0.08);
    z-index: 2000;
    padding: 6px 0;
}

.search-results::-webkit-scrollbar {
    width: 5px;
}
.search-results::-webkit-scrollbar-track {
    background: transparent;
}
.search-results::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.25);
    border-radius: 3px;
}

.search-category {
    padding: 8px 14px 4px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted, rgba(255,255,255,0.35));
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
}

.search-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 14px;
    cursor: pointer;
    transition: background 0.15s;
}

.search-item:hover,
.search-item.active {
    background: rgba(59, 130, 246, 0.12);
}

.search-item-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.search-item-label {
    font-size: 13px;
    color: var(--text-main, #e2e8f0);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-item-sub {
    font-size: 11px;
    color: var(--text-muted, rgba(255,255,255,0.35));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-badge {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 3px;
    letter-spacing: 0.03em;
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
}

.badge-fleet {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-ok {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.25);
}

.badge-warn {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.25);
}

.badge-apple {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.25);
}

.badge-osm {
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.search-loading,
.search-empty {
    padding: 16px 14px;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted, rgba(255,255,255,0.35));
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
}

/* Temporary pin marker for location search results */
.search-pin-marker {
    background: transparent;
    border: none;
}

.search-pin-pulse {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.6);
    border: 2px solid #60a5fa;
    animation: search-pulse 1.5s ease-out infinite;
}

@keyframes search-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.5); }
    70%  { box-shadow: 0 0 0 14px rgba(59, 130, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}